#include "cxlocalsetdialog.h"
#include "ui_cxlocalsetdialog.h"
#include "cxglobal.h"
#include <QFileDialog>


CxLocalSetDialog::CxLocalSetDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CxLocalSetDialog)
{
    ui->setupUi(this);
    InitPath();
}

CxLocalSetDialog::~CxLocalSetDialog()
{
    delete ui;
}

void CxLocalSetDialog::on_toolButton_clicked()
{
    QString filename;
    filename=QFileDialog::getExistingDirectory();
    ui->lineEdit->setText(filename);
}

void CxLocalSetDialog::on_toolButton_2_clicked()
{
    QString filename;
    filename=QFileDialog::getExistingDirectory();
    ui->lineEdit_2->setText(filename);
}

void CxLocalSetDialog::on_toolButton_3_clicked()
{
    QString filename;
    filename=QFileDialog::getExistingDirectory();
    ui->lineEdit_3->setText(filename);
}

void CxLocalSetDialog::on_buttonBox_accepted()
{
    CxGlobal gl;
    gl.setlogFilepath(ui->lineEdit->text().toStdString());
    gl.setsetFilepath(ui->lineEdit_2->text().toStdString());
    gl.setVideofilepath(ui->lineEdit_3->text().toStdString());
}


void    CxLocalSetDialog::InitPath()
{
    CxGlobal gl;
    ui->lineEdit->setText(QString::fromStdString(gl.getlogFilepath()));
    ui->lineEdit_2->setText(QString::fromStdString(gl.getsetFilepath()));
    ui->lineEdit_3->setText(QString::fromStdString(gl.getVideofilepath()));
}
